package site.yunnong.atvris.portal.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import site.yunnong.atvris.common.api.ResultVO;
import site.yunnong.atvris.common.dto.TagsRandomQueryParam;
import site.yunnong.atvris.portal.service.FrontTagsService;

import javax.annotation.Resource;


/**
 * 标签表
 *
 * @author zhangjinghao
 * @email jhzhang9102@163.com
 * @date 2021-07-09 23:45:38
 */
@RestController
@RequestMapping("/tags")
public class TagsController {

    @Resource
    private FrontTagsService frontTagsService;

    /**
     * 列表
     */
    @ApiOperation("随机查询指定个数的标签")
    @PostMapping("/list")
    public ResultVO list(@RequestBody TagsRandomQueryParam param){
        return new ResultVO().success(frontTagsService.queryPage(param));
    }
    
    @ApiOperation("根据标签名前缀匹配标签")
    @GetMapping("/query-all")
    public ResultVO queryAll() {
        return new ResultVO().success(frontTagsService.queryAll());
    }
    
    @ApiOperation("查询视频相关的tags")
    @GetMapping("/query-video-tags")
    public ResultVO queryVideoTags(@RequestParam("uvid") Long uvid) {
        return new ResultVO().success(frontTagsService.queryVideoTags(uvid));
    }
}
